<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
	rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="./css/nav.css">
<link rel="stylesheet" href=".css/reset.css" />
<title>文章列表</title>
</head>
<body>
	<div id="max">
		<div id="nav">
			<ul> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/index.jsp">首页</a></li> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/login.jsp">登录</a></li> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/add.jsp">添加微博</a></li> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/list.do">管理微博</a></li> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/login.jsp">登出</a></li> 
				<li><a href="http://www.infojhc.cn/weibo201631011600055/register.jsp">注册</a></li> 
			</ul>
		</div>
		<h1>文章列表</h1>
		<ul>
			<c:forEach var="t" items="${articles}">
				<li>
					<h3>${t.title}</h3>
					<p>${t.content}</p>
					<p>${t.publishDate}</p>
					<p>
						<a href="./del.do?id=${t.id}">删除</a>
					</p>
				</li>
			</c:forEach>
		</ul>
		<ul class="pagination" id="pagination">
			<li class="${currentPage == 0 ? 'disabled' : ''}">${currentPage == 0? null: '<a href="./list.do?page='}
				${currentPage == 0 ? null : currentPage - 1} ${currentPage == 0? null: '">'}
					<span>&laquo;</span>
			${currentPage == 0? null: '</a>'}</li>
	
	
			<c:if test="${currentPage < 5}">
				<c:forEach var="page" begin="0" end="${currentPage + 4}">
					<li class="${currentPage == page ? 'active' : ''}"><a
						href="./list.do?page=${page}">${page}</a></li>
				</c:forEach>
				<li class="disabled"><a>...</a></li>
				<li><a href="./list.do?page=${total}">${total}</a></li>
			</c:if>
	
	
			<c:if test="${currentPage >= 5 && currentPage <= total -5}">
				<li><a href="./list.do?page=${0}">${0}</a></li>
				<li class="disabled"><a>...</a></li>
				<c:forEach var="page" begin="${currentPage - 3}"
					end="${currentPage + 4}">
					<li class="${currentPage == page ? 'active' : ''}"><a
						href="./list.do?page=${page}">${page}</a></li>
				</c:forEach>
				<li class="disabled"><a>...</a></li>
				<li><a href="./list.do?page=${total}">${total}</a></li>
			</c:if>
	
			<c:if test="${currentPage > total - 5}">
				<li><a href="./list.do?page=0">0</a></li>
				<li class="disabled"><a>...</a></li>
				<c:forEach var="page" begin="${total -5}" end="${total}">
					<li class="${currentPage == page ? 'active' : ''}"><a
						href="./list.do?page=${page}">${page}</a></li>
				</c:forEach>
			</c:if>
	
			<li class="${currentPage == total ? 'disabled' : ''}">${currentPage == total? null: '<a href="./list.do?page='}
				${currentPage == total ? null : currentPage+ 1} ${currentPage == total? null: '">'}
					<span>&raquo;</span>
			${currentPage == total? null: '</a>'}</li>
		</ul>
	</div>
</body>
</html>